package com.wzk.travelspringboot.controller;

import com.wzk.travelspringboot.dto.Result;
import com.wzk.travelspringboot.service.WeatherService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: WangZiKang
 * @Date: 2025/1/18 11:26
 */

@Slf4j
@RestController
@RequestMapping("/weather")
@RequiredArgsConstructor
public class WeatherController {

    private final WeatherService weatherService;

    @GetMapping("/now")
    public Result getOneDay(@RequestParam(name = "cityName") String cityName){
        return weatherService.now(cityName);
    }

    @GetMapping("/hour")
    public Result getPerHour(@RequestParam(name = "cityName") String cityName){
        return weatherService.perHour(cityName);
    }

    @GetMapping("/sevenDay")
    public Result getSevenDay(@RequestParam(name = "cityName") String cityName){
        return weatherService.sevenDay(cityName);
    }

}
